﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Utility
{
    public static class Sha1Util
    {
        public static string Encryptor(string str)
        {
            byte[] data = System.Text.Encoding.Default.GetBytes(str);

            System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();            

            //得到哈希值

            byte[] result = sha1.ComputeHash(data);

            //转换成为字符串的显示

            return System.BitConverter.ToString(result).Replace("-", "");
        }
    }
}
